package main

import (
	"fmt"
	"sync"
)

type dan struct {
	name string
}

var once sync.Once

var dann = &dan{}

func getInstance() *dan {
	once.Do(func() {
		dann = &dan{
			name: "dan",
		}
	})
	return dann
}

var wg sync.WaitGroup

func main() {

	wg.Add(3)

	for i := 0; i < 3; i++ {
		go func() {
			d := getInstance()
			fmt.Println(d)
			wg.Done()
		}()
	}

	wg.Wait()
}
